package com.example.udpDemo.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * Description: 传感器检测对象枚举
 *
 * @author sjt Administrator
 * @since 2023/12/3 16:00
 */
@Getter
@AllArgsConstructor
public enum DetectObjectEnum {
    UNKNOWN(0x0000, "未知", "未知"),
    COMBUSTIBLE_GAS(0x0054, "可燃气体", "COMBUSTIBLE_GAS"),
    METHANE(0x0056, "甲烷", "CH4"),
    ETHANOL(0x0057, "乙醇", "C2H5OH"),
    CARBON_MONOXIDE(0x0058, "一氧化碳", "CO"),
    HYDROGEN_SULFIDE(0x0059, "硫化氢", "H2S"),
    OXYGEN(0x005A, "氧气", "O2"),
    METHANOL(0x005B, "甲醇", "CH3OH"),
    ETHANE(0x005C, "乙烷", "C2H6"),
    BUTANE(0x005D, "丁烷", "C4H10"),
    PENTANE(0x005E, "戊烷", "C5H12"),
    HEXANE(0x005F, "己烷", "C6H14"),
    HYDROGEN(0x0060, "氢气", "H2"),
    ISOBUTANE(0x0061, "异丁烷", "C4H10"),
    ETHYLENE(0x0062, "乙烯", "CH2=CH2"),
    PROPYLENE(0x0063, "丙烯", "C3H6"),
    BUTENE(0x0064, "正丁烯", "C4H8"),
    BUTADIENE(0x0065, "丁二烯", "C4H6"),
    ACETYLENE(0x0066, "乙炔", "C2H2"),
    BENZENE(0x0067, "苯", "C6H6"),
    TOLUENE(0x0068, "甲苯", "C7H8"),
    XYLENE(0x0069, "邻二甲苯", "CH3C6H4CH3"),
    AMMONIA(0x006A, "氨", "NH3"),
    DEUTEROCHLOROFORM(0x006B, "氘代氯仿", "CDCL3"),
    DICHLOROMETHANE(0x006C, "二氯甲烷", "CH2Cl2"),
    PROPANOL(0x006D, "丙烯醇", "C3H6O"),
    PROPANE(0x006E, "丙烷", "C3H8"),
    GASOLINE(0x006F, "汽油", "CnH2n+2"),
    JET_FUEL(0x0070, "喷气燃料", "喷气燃料"),
    KEROSENE(0x0071, "煤油", "煤油"),
    PETROLEUM_ETHER(0x0072, "石油醚", "石油醚"),
    EPOXY_ETHANE(0x0073, "环氧乙烷", "C2H4O"),
    DIETHYL_ETHER(0x0074, "乙醚", "C2H5OC2H5"),
    BUTANOL(0x0075, "丁醇", "C4H9OH"),
    FORMALDEHYDE(0x0076, "甲醛", "HCHO"),
    ACETALDEHYDE(0x0077, "乙醛", "CH3CHO"),
    ACETONE(0x0078, "丙酮", "CH3COCH3"),
    METHYL_ACETATE(0x0079, "醋酸甲酯", "C3H6O2"),
    ETHYL_ACETATE(0x007A, "醋酸乙酯", "C4H8O2"),
    BUTYL_ACETATE(0x007B, "醋酸丁酯", "C6H12O2"),
    CHLOROFORM(0x007C, "氯代甲烷", "氯代甲烷"),
    CHLOROETHENE(0x007D, "氯乙烯", "C2H3Cl"),
    DIMETHYL_CARBONATE(0x007E, "碳酸二甲酯", "C3H6O3"),
    DIMETHYL_TOLUENE(0x007F, "二甲苯", "C6H4(CH3)2"),
    PHENOL(0x0080, "苯酚", "C6H6O"),
    CHLORINE(0x0081, "氯气", "CL2"),
    HEXANE_2(0x0082, "正己烷", "C6H14"),
    ANILINE(0x0083, "苯胺", "C6H7N"),
    HYDROCARBON(0x0084, "碳氢", "碳氢"),
    SULFUR_DIOXIDE(0x0085, "二氧化硫", "SO2"),
    VOC(0x0086, "VOC", "VOC"),
    HYDROGEN_CYANIDE(0x0087, "氰化氢", "HCN"),
    ACRYLONITRILE(0x0088, "丙烯腈", "C2H3CN"),
    EPOXY_PROPANE(0x0089, "环氧丙烷", "C3H6O"),
    POTASSIUM_CYANIDE(0x008A, "氰化钾", "KCN"),
    CYANOGEN_BROMIDE(0x008B, "溴化氰", "BrCN"),
    DIMETHOATE(0x008C, "敌敌畏", "C4H7Cl2O4P"),
    ETHYL_ACETATE_2(0x008D, "乙酸乙酯", "C4H8O2"),
    CARBON_DIOXIDE(0x008E, "二氧化碳", "CO2"),
    ACETIC_ACID(0x008F, "醋酸", "C2H4O2"),
    HYDROGEN_CHLORIDE(0x0090, "氯化氢", "HCL"),
    ACRYLATE(0x0091, "丙烯酸酯", "CH2=CHCOOR"),
    FREON(0x0092, "氟利昂", "氟利昂"),
    DIESEL(0x0093, "柴油", "柴油"),
    METHYL_ETHYL_KETONE(0x0094, "甲基乙基酮", "C4H8O"),
    DIETHYL_ETHER_2(0x0095, "丙二醇丁醚", "C7H16O2"),
    TETRAHYDROFURAN(0x0096, "四氢呋喃", "C4H8O"),
    ISOBUTENE(0x0097, "异丁烯", "C4H8"),
    BORANE(0x0098, "硼烷", "B2H6"),
    SILANE(0x0099, "硅烷", "SiH4"),
    PHOSPHINE(0x009A, "磷化氢", "PH3"),
    TRIMETHYLBORON(0x009B, "三甲基硼", "C3H9B"),
    CARBON_DISULFIDE(0x009C, "二硫化碳", "CS2"),
    ETHYL_BROMIDE(0x009D, "溴乙烷", "C2H5Br"),
    TRIETHYLAMINE(0x009E, "三甲胺", "C3H9N"),
    NITROBENZENE(0x009F, "硝基苯", "C6H5NO2"),
    STYRENE(0x00A0, "苯乙烯", "C8H8"),
    ISOPROPYL_ALCOHOL(0x00A1, "异丙醇(IPA)", "C3H8O"),
    METHYL_ISOCYANATE(0x00A2, "甲基异氰酸酯", "C2H3NO"),
    DIMETHYL_FORMAMIDE(0x00A3, "二甲基甲酰胺", "C3H7NO"),
    DIISOPROPYLAMINE(0x00A4, "二异丙胺", "C6H15N"),
    ACRYLIC_ACID(0x00A5, "丙烯甘醇", "C3H8O2"),
    METHYL_ETHYL_KETONE_2(0x00A6, "丁酮(MEK)", "CH3CH2COCH3"),
    METHYL_FORMATE(0x00A7, "甲酸乙酯", "C3H6O2"),
    NAPHTHALENE(0x00A8, "萘", "C10H8"),
    BUTYL_ACRYLATE(0x00A9, "丙烯酸丁酯", "C7H12O2"),
    ETHYLENE_GLYCOL(0x00AA, "乙二醇", "C2H6O2"),
    BUTYLENE_GLYCOL(0x00AB, "丁二醇", "C4H10O2"),
    OXALIC_ACID(0x00AC, "乙二酸", "C2H2O4"),
    TRIMETHYLOLPROPANE(0x00AD, "三羟甲基丙烷", "C6H14O3"),
    PHOSPHORUS_TRICHLORIDE(0x00AE, "三氯化磷", "PCL3"),
    TDI(0x00AF, "TDI", "C9H6N2O2"),
    FLUORINE(0x00B0, "氟气", "F2"),
    METHYL_CHLORIDE(0x00B1, "一氯甲烷", "CH3Cl"),
    ARSINE(0x00B2, "砷烷", "AsH3"),
    SILICON_TETRACHLORIDE(0x00B3, "四氯化硅", "SiCL4"),
    ACETONITRILE(0x00B4, "乙腈", "C2H3N"),
    RESERVED(0x00B5, "保留", "保留"),
    DIBORANE(0x00B6, "乙硼烷", "B2H6"),
    NITROUS_OXIDE(0x00B7, "一氧化二氮", "N2O"),
    NITROGEN_DIOXIDE(0x00B8, "二氧化氮", "NO2"),
    NITROGEN(0x00B9, "氮气", "N2"),
    DIMETHYLAMINE(0x00BA, "二甲胺", "C2H7N"),
    CHLOROPROPENE(0x00BB, "氯丙烯", "C3H5Cl"),
    METHYLAMINE(0x00BC, "甲胺", "CH3NH2"),
    FLUOROBENZENE(0x00BD, "氟苯", "C6H5F"),
    HYDROFLUORIC_ACID(0x00BE, "氟化氢", "HF"),
    METHYL_LACTATE(0x00BF, "乳酸甲酯", "C4H8O3"),
    DIMETHYL_SULFATE(0x00C0, "硫酸二甲酯", "C2H6O4S"),
    RESERVED_2(0x00C1, "保留", "保留"),
    RESERVED_3(0x00C2, "保留", "保留"),
    TRICHLOROETHYLENE(0x00C3, "三氯乙烯", "C2HCl3"),
    NITRIC_OXIDE(0x00C4, "一氧化氮", "NO"),
    DIMETHYL_ETHER(0x00C5, "二甲醚", "CH3OCH3"),
    METHYLAMINE2(0x00C6, "一甲胺", "CH3NH2"),
    CYCLOHEXANONE(0x00C7, "环己酮", "C6H10O"),
    HYDROGEN_SELENIDE(0x00C8, "硒化氢", "H2Se"),
    PROPANOL_2(0x00C9, "丙醇", "C3H8O"),
    CHLORINE_DIOXIDE(0x00CA, "二氧化氯", "CLO2"),
    ALLYL_ALCOHOL(0x00CB, "烯丙醇", "C3H6O"),
    ACRYLALDEHYDE(0x00CC, "丙烯醛", "C3H4O"),
    PYRIDINE(0x00CD, "吡啶", "C5H5N"),
    DICHLOROETHANE(0x00CE, "二氯乙烷", "C2H4CL2"),
    ACETIC_ANHYDRIDE(0x00CF, "醋酐", "C4H6O0"),
    HYDROGEN_BROMIDE(0x00D0, "溴化氢", "HBR"),
    BROMINE(0x00D1, "溴素", "BR2"),
    CHLOROETHANE(0x00D2, "氯乙烷", "C2H5Cl"),
    HEXANE_3(0x00D3, "正己烷", "C6H14"),
    ISOPRENE(0x00D4, "二异丁烯", "C8H16"),
    SULFUR_TRIOXIDE(0x00D5, "三氧化硫", "SO3"),
    EUGENOL(0x00D6, "月桂烯", "C10H16"),
    PINENE(0x00D7, "蒎烯", "C10H16"),
    METHANESULFONYL_CHLORIDE(0x00D8, "甲烷磺酰氯", "CH3SO2Cl"),
    PHOSPHORYL_CHLORIDE(0x00D9, "三氯氧磷", "POCl3"),
    BUTANOL_2(0x00DA, "正丁醇", "C4H10O"),
    TETRAFLUOROETHANE(0x00DB, "四氟乙烷", "CH2FCF3"),
    PHOSGENE(0x00DC, "光气", "COCl2"),
    DIETHYL_ETHER_3(0x00DD, "乙二醚", "C4H8O2"),
    ER445(0x00DE, "ER445", "ER445"),
    OZONE(0x00DF, "臭氧", "O3"),
    METHYL_BROMIDE(0x00E0, "溴甲烷", "CH3Br"),
    HYDROGEN_PEROXIDE(0x00E1, "过氧化氢", "H2O2"),
    PM25(0x00E2, "PM2.5", "PM2.5");

    private final int code;
    private final String chineseName;
    private final String gasType;


    public static DetectObjectEnum getByCode(int code) {
        return Arrays.stream(DetectObjectEnum.values()).filter(v -> code == v.getCode()).findFirst().orElse(UNKNOWN);
    }
}

